package com.ruoyi.web.controller.pc.anon;

import com.ruoyi.blogs.domain.BsUserFollow;
import com.ruoyi.blogs.service.IBsUserFollowService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "关注粉丝")
@RestController
@RequestMapping("/anon/follow")
public class AnonUserFollowController extends BaseController {
    @Autowired
    private IBsUserFollowService bsUserFollowService;

    /**
     * 根据userId获取关注列表
     */
    @ApiOperation("获取关注列表")
    @GetMapping("/follows")
    public TableDataInfo getFollow(BsUserFollow bsUserFollow){
        startPage();
        List<SysUser> list = bsUserFollowService.selectUserListByFollow(bsUserFollow);
        return getDataTable(list);
    }

    /**
     * 根据userId获取粉丝列表
     */
    @ApiOperation("获取粉丝列表")
    @GetMapping("/fans")
    public TableDataInfo getFans(BsUserFollow bsUserFollow){
        startPage();
        List<SysUser> list = bsUserFollowService.selectUserListByFans(bsUserFollow);
        return getDataTable(list);
    }
}
